package com.zhao.fishingguideserver.service.impl;

import com.zhao.fishingguideserver.POJO.User;
import com.zhao.fishingguideserver.mapper.UserMapper;
import com.zhao.fishingguideserver.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 用户服务实现类
 */
@Service
public class UserServiceImpl implements UserService {
    @Autowired
    private UserMapper userMapper;
    
    @Override
    public void register(User user) {
        // 密码已在Controller层加密，此处不需要重复加密
        userMapper.register(user);
    }

    @Override
    public User selectUserByName(String username) {
        return userMapper.selectUserByName(username);
    }
    
    @Override
    public User selectUserById(Long userId) {
        return userMapper.selectUserById(userId);
    }
    
    @Override
    public int updateUser(User user) {
        return userMapper.updateUser(user);
    }
}
